package mamikeji.liaowa.widget;

import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import mamikeji.liaowa.R;

/**
 * Created by 廉冲-android开发 on 2017/7/3.
 */
public class ForPopWin extends PopupWindow {
    private View mainView;
    private RelativeLayout relativeLayout_pop_circle_set_report, relativeLayout_pop_circle_set_shape;

    OnItemClickListener mOnItemClickListener;

    public ForPopWin (Activity paramActivity, float paramInt1, float paramInt2){
        super(paramActivity);
        //窗口布局
        mainView = LayoutInflater.from(paramActivity).inflate(R.layout.popwin_cilrcle_set, null);
        //分享布局
        relativeLayout_pop_circle_set_shape = ((RelativeLayout)mainView.findViewById(R.id.relativeLayout_pop_circle_set_shape));
        //复制布局
        relativeLayout_pop_circle_set_report = (RelativeLayout)mainView.findViewById(R.id.relativeLayout_pop_circle_set_report);
        //设置每个子布局的事件监听器
            relativeLayout_pop_circle_set_shape.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mOnItemClickListener.onpop_circle_set_shape();
                }
            });
            relativeLayout_pop_circle_set_report.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mOnItemClickListener.onpop_circle_set_report();
                }
            });
        setContentView(mainView);
        //设置宽度
        setWidth((int) paramInt1);
        //设置高度
        setHeight((int)paramInt2);
        //设置显示隐藏动画
        setAnimationStyle(R.style.Pop_circle_set_animTools);
        //设置背景透明
        setBackgroundDrawable(new ColorDrawable(0));
    }

    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }

    public interface OnItemClickListener {
        void onpop_circle_set_shape();

        void onpop_circle_set_report();
    }
}